﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace _3.ZipFile
{
    class Program
    {
        const string fileName = "zipped.zip";

        static void Main(string[] args)
        {
            ZipFileTest();
            UnzipFileTest();
        }

        private static void ZipFileTest()
        {
            File.Delete(fileName);

            using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile(fileName))
            {                
                zip.AddFile("1.txt");
                zip.AddFile("2.txt");
                zip.AddFile("3.txt");

                zip.Save();
            }
        }

        private static void UnzipFileTest()
        {
            using (Ionic.Zip.ZipFile z =  new Ionic.Zip.ZipFile(fileName))
            {
                z.ExtractAll(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Unzipped", Ionic.Zip.ExtractExistingFileAction.OverwriteSilently);
            }
            
            
        }
    }
}
